<?php

namespace app\common\model;

class WalletAddressModel extends BaseModel{

	protected $table = 'tp_user_wallet_address';


	/*
	 钱包地址获取uid
	 */
	public function getUidByAddress($wid,$address) {
		$data = $this->where('wid',$wid)->where('address', $address)->find();
		return $data;
	}

	/*
	 钱包地址获取uid
	 */
	public function getAddressByUid($uid,$wid) {
		$data = $this->where('uid',$uid)->where('wid', $wid)->find();
		return $data;
	}
	/*
	分配钱包地址
	 */
	public function addData($data){
		$res = $this->insert($data);
		return $res;
	}	

	/*
	更新区块
	 */
	public function updateBlock($uid,$cid,$block,$total_count=0){
		$res = $this->where('uid',$uid)->where('cid',$cid)->update([
			'block'=>$block,
			'total_count'=>$total_count
		]);
		return $res;
	}
}
